home *** CD-ROM | disk | FTP | other *** search
- Path: news.cc.uic.edu!sunphy1!olczyk
- From: olczyk@sunphy1 (Thadeus Olczyk)
- Newsgroups: comp.lang.c++,comp.lang.pascal.delphi.misc
- Subject: Re: C++ with Zapp vs. Delphi
- Followup-To: comp.lang.c++,comp.lang.pascal.delphi.misc
- Date: 16 Jan 1996 08:32:41 GMT
- Organization: University of Illinois at Chicago
- Message-ID: <4dfnr9$4c02@tigger.cc.uic.edu>
- References: <4coar6$d4n@sun4.bham.ac.uk> <4coip7$69s@news1.usa.pipeline.com> <Eul+w0JfFyQD089yn@oslonett.no>
- NNTP-Posting-Host: sunphy1.phy.uic.edu
-
- Unfortunately it was late two hours ago.
- I will follow up more thoroughy later but there were two parts I couldn't
- resist.
- Rune Moberg (mobergru@oslonett.no) wrote:
- : Anyway, in Bjarne's book about C++, which I haven't actually read, I just
- : looked up "polymorphism", and Bjarne says (this can take a while, I
- : type slow, since my keyboard has a sticky n-key):
- : "Pointers to functions can be used to provide polymorphic routines, that
- : is routines that can be applied to objects of many different types:
-
- : typedef int (*CFT) (void*,void*);
- : void sort(void* base, unsigned n, unsigned int sz, CFT cmp)"
- : (don't worry, the n-key wasn't sticky after all, so typing went ahead
- : at full speed. Bjarne mentions MI a couple of places (4), but not as
- : a requirement for polymorphism)
-
- : Now, I have some C experience (half a year), but the above is totally
- If you can't read the above then your half year of experience was rather
- poor. Unfortunately the biggest fraud in the computer world are the shelves
- filled with books entitled "Teach Yourself xxx in 21 day for complete
- morons who want to unlease $60 instead of $30 for the good book lying
- on the bottom shelf covered with dust."
-
- : unreadable to me (the function header). Anyway, the concept is familiar;
- : you have a function (or preferably a method) who accept an object as a
- : parameter.
-
- Bjarne's book is meant for experienced C programmers. Meaning programmers who
- can read that code. Lipman is a better book for beginers. His point is
- that you can do OO in C ( preC++). The example is one of the first examples of
- polymorphism. Furthermore in C++ it would read
-
- class SortedList
- {
- ...
- }
-
- class SortedObject
- {
- ...
- virtual boolean CompareTo();
- ...
- }
-
- class MyOb:public SortedObject
- {
- ....
- boolean CompareTo();
- ...
- }
-
- : So far, this is very possible in Object Pascal, and a concept heavily
- : used by Delphi. When you put a component on a form, you can attach event
- : handlers. The parameter of an event handler is "Sender" of type TObject,
- : thus I can share the same event handler among different components,
- : and use typecasting whenever I need to reference something specific to
- : a child object.
- : thus:
- : (Sender as TEdit).CutToClipboard;
- : will work for TEdit and all descendants of TEdit, but will generate an
- : exception for any other object.
-
- : Object Pascal has a different type cast (also available in Delphi) that
- : instead of generating an exception will most probably crash (AFAIK):
- : TEdit(Sender).CutToClipboard; {a somewhat more direct approach}
- For an event this is fine. But for a method it's not. A method won't know
- what components might be sent to it. So you have to write that line for
- each component. Of course if you buy new components, you have to add them
- to the method. The class that contains that method can never be declared
- closed to change ( save for bug fixes ). That's a mainenance nightmare.
-
- : >Let's. RAD has recently come into disfavor in publications like JOOP, Object,
- : >and even Byte. Last summer InfoWorld reported a growing disillusionment
-
- : Borland has a couple of big customers that have shared their success
- : stories with the public. Remember, Delphi isn't even a year old, so the
- : publications you've mentioned aren't really uptodate. I even emailed a guy
- : who wrote a piece for Byte last year (about RAD, summer issue), and he
- : thought Delphi was ok. RAD so far has meant VB. Delphi is not VB. Granted,
- : it's simple to use, but it's powerful at the same time.
- The articles did not trash RAD tools, they trashed RAD.
- As for the projects that you mention they can only be slightly older then one
- year. That means that it's not possible to judge their success or failure.
- And of course, all this follows Fred Brooks outline of new proccesses that
- eventually failed.
-
- : VC++'s MFC library doesn't make much use of inheritance at all, does it?
- : Atleast that's what I've been told from someone residing in one of the
- : C++ newsgroup (maybe it was a troll, but I've heard it elsewhere as well,
- : MFC is supposedly bad OOP)?
- From Allen Holub's book Enough Rope to Shoot Yourself in the Foot.
-
- The programming and design problems discussed here are not student code,
- unfortunately.
- Many of the examples of how not to do thingsd are taken from a commercial
- product:
- the Microsoft Foundation Class (MFC) library. As far as I can tell, this
- library was designed without a thought to good maintenance, by people unaware
- of even rudimentary object-oriented design principles.
-
- As for grades I wouldn't boast of high grades in this day and age. In Dec 94
- the Chicago Tribune ran an article which said that half of the graduating
- college students couldn't read. Many of these were straight A students.
- -----------------------------------
- Thaddeus L. olczyk
-